package com.monkey.luffer.springboot.demo.basis.SPI.Impl;

import com.monkey.luffer.springboot.demo.basis.SPI.OrderService;
import lombok.extern.slf4j.Slf4j;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @Author: dengkaibing
 * @Description:
 * @Date: 2021/12/26 15:12
 * @company 翼支付
 */
@Slf4j
public class OrderTest {

    public static void main(String[] args) {
        /**类加载**/
        ServiceLoader<OrderService> serviceLoader = ServiceLoader.load(OrderService.class);
        Iterator<OrderService> iterator = serviceLoader.iterator();
        /**加载遍历**/
        while (iterator.hasNext()) {
            OrderService orderService = iterator.next();

            orderService.creatOrder();
        }
    }
}
